package com.example.springbootdemo.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Controller+ResponseBody
 * 或者
 * RestController：无法返回
 *
 */
@Controller
public class MyController {
    @RequestMapping("/")
    @ResponseBody
    public String home(){
        return "home";
    }

    @RequestMapping("getUser")
    @ResponseBody
    public String getUser(){
        return "小红";
    }

    @RequestMapping(value = "testProduces",produces = "application/json")
    @ResponseBody
    public String testProduces(){
        return "testProducesAAAa";
    }
}
